import {
  Button,
  Table,
  TableColumn,
  Input,
  Notification,
  MessageBox,
  Message,
  Main,
  Container,
  Header,
  Aside,
  Menu,
  MenuItem,
  Submenu,
  RadioGroup,
  RadioButton,
  Option,
  Select,
  DatePicker,
  Pagination,
  Tag,
  Checkbox,
  Tooltip,
  Dialog,
  Form,
  FormItem,
  Popover,
  Upload,
  Radio,
  Breadcrumb,
  BreadcrumbItem,
  Col,
  Transfer,
  Loading,
  Switch,
  Scrollbar,
  InputNumber,
  Tabs,
  TabPane
} from 'element-ui'
import './element-variables.scss'

export default {
  install(V) {
    V.use(Button)
    V.use(Table)
    V.use(TableColumn)
    V.use(Input)
    V.use(Main)
    V.use(Container)
    V.use(Header)
    V.use(Aside)
    V.use(Menu)
    V.use(MenuItem)
    V.use(Submenu)
    V.use(RadioGroup)
    V.use(RadioButton)
    V.use(Option)
    V.use(Select)
    V.use(DatePicker)
    V.use(Pagination)
    V.use(Tag)
    V.use(Checkbox)
    V.use(Tooltip)
    V.use(Dialog)
    V.use(Form)
    V.use(FormItem)
    V.use(Popover)
    V.use(Upload)
    V.use(Radio)
    V.use(Breadcrumb)
    V.use(BreadcrumbItem)
    V.use(Col)
    V.use(Transfer)
    V.use(Loading)
    V.use(Switch)
    V.use(Scrollbar)
    V.use(InputNumber)
    V.use(Tabs)
    V.use(TabPane)

    V.prototype.$confirm = MessageBox.confirm
    V.prototype.$prompt = MessageBox.prompt
    V.prototype.$alert = MessageBox.alert
    V.prototype.$notify = Notification
    V.prototype.$message = Message

    // 注入定制样式的消息提示
    V.prototype.$serverErrNotify = (msg) => {
      Notification.error({
        title: '错误',
        message: msg || '服务端请求异常'
      })
    }
  }
}
